<template>
  <router-view :key="$route.fullPath"></router-view>
</template>
<script setup>
import { watch } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()

// 监听路由变化
watch(
  () => route.fullPath,
  (newPath, oldPath) => {
    console.log('路由路径变化:', {
      oldPath,
      newPath,
      fullPath: route.fullPath,
      path: route.path,
      params: route.params,
      query: route.query
    })
  },
  { immediate: true } // 初始化时立即执行一次
)
</script>
<style lang="less">
</style>
